package com.kaochong.xcx.service;

import com.kaochong.xcx.dao.UserMapper;
import com.kaochong.xcx.entity.User;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @author han
 * @date 2018-08-08 15:26
 */
@Service
public class DemoServiceImpl {
	@Autowired
	UserMapper userMapper;
	
	public User selectById(Long userId){
		User user = userMapper.selectByPrimaryKey(userId);
		System.out.println(user);
		return user;
	}
	
	@Transactional
	public User insert(User user) {
		int i = userMapper.insertUser(user);
		throw new RuntimeException();
	}
}
